package com.xxgc.eow.service.impl;

import com.github.pagehelper.PageHelper;
import com.xxgc.eow.entity.Companypost;
import com.xxgc.eow.mapper.CompanypostMapper;
import com.xxgc.eow.service.ICompanypostService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 企业岗位表 服务实现类
 * </p>
 *
 * @author Mr.Abel
 * @since 2023-05-22
 */
@Service
public class CompanypostServiceImpl extends ServiceImpl<CompanypostMapper, Companypost> implements ICompanypostService {

    @Resource
    private CompanypostMapper companypostMapper;

    @Override
    public List<Companypost> getAllCompanyPost() {
        return companypostMapper.selectAll();
    }

    @Override
    public List<Companypost> getByCompanyId(int CompanyId) {
        return companypostMapper.selectByCompanyId(CompanyId);
    }

    @Override
    public Companypost getByPostId(int postId) {
        return companypostMapper.selectByPrimaryKey(postId);
    }

    @Override
    public int addCompanyPost(Companypost companypost) {
        return companypostMapper.insert(companypost);
    }

    @Override
    public int deleteByPrimaryKey(int postId) {
        return companypostMapper.deleteByPrimaryKey(postId);
    }

    @Override
    public int delCompanyPostByPostId(Companypost companypost) {
        return companypostMapper.deleteByPostId(companypost);
    }

    @Override
    public int delCompanyPostByCompanyId(Companypost companypost) {
        return companypostMapper.deleteByCompanyId(companypost);
    }

    @Override
    public int updatCompanyPost(Companypost companypost) {
        return companypostMapper.updateByPrimaryKey(companypost);
    }

    @Override
    public List<Companypost> getAllPage(int pageNum,int pageSize,String keyWord) {
        PageHelper.startPage(pageNum,pageSize);
        return companypostMapper.selectByKeyWord(keyWord);
    }

    @Override
    public List<Companypost> getAllPage(String keyWord) {
        return companypostMapper.selectByKeyWord(keyWord);
    }
}
